package com.example.demo.controller;

import com.example.demo.service.ComponentService;
import com.example.demo.utils.Result;
import com.example.demo.vo.componentVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/component")
@ResponseBody
public class componentController {
    @Autowired
    ComponentService componentService;

    @RequestMapping(method = RequestMethod.POST,value = "/add")
    public Result add(componentVo component){
           return componentService.add(component);
    }


    @RequestMapping("/getComponent")
    public Result getComponent(){
        return componentService.getComponent();
    }

}
